import { RouteRecordRaw } from 'vue-router'
import { i18n } from '@/locales'
const { $t } = i18n

// 布局
const BasicLayout = () =>
	import(
		/* webpackChunkName: "basic-layout" */ '@/entry_desktop/layouts/BasicLayout.vue'
	)

// 首页
const Home = () =>
	import(/* webpackChunkName: "home" */ '@/entry_desktop/views/Home/index.vue')

// 流程中心
const ProcessCenter = () =>
	import(
		/* webpackChunkName: "process-center" */ '@/entry_desktop/views/ProcessCenter/index.vue'
	)
const delegation = () =>
	import(
		/* webpackChunkName: "process-center" */ '@/entry_desktop/views/Delegation/index.vue'
	)
const AddDelegation = () =>
	import(
		/* webpackChunkName: "process-center" */ '@/entry_desktop/views/Delegation/AddDelegation.vue'
	)
//历史数据
const HistoryDatasetAssociations = () =>
	import(
		/* webpackChunkName: "process-center" */ '@/entry_desktop/views/Delegation/HistoryDatasetAssociations.vue'
	)
// 个人中心
const PersonalCenter = () =>
	import(
		/* webpackChunkName: "Personal-center" */ '@/entry_desktop/views/PersonalCenter/index.vue'
	)
// 基本信息
// const BasicInformation = () =>
// 	import(
// 		/* webpackChunkName: "Basic-information" */ '@/entry_desktop/views/PersonalCenter/components/BasicInformation/index.vue'
// 	)
// // 密码设置
// const Password = () =>
// 	import(
// 		/* webpackChunkName: "Password" */ '@/entry_desktop/views/PersonalCenter/components/Password/index.vue'
// 	)

// 三级详情
const AttachmentDetail = () =>
	import(
		/* webpackChunkName: "Attachment-detail" */ '@/entry_desktop/components/AttachmentList/AttachmentDetails/index.vue'
	)

// 二级中心
const AttachmentCenter = () =>
	import(
		/* webpackChunkName: "Attachment-center" */ '@/entry_desktop/components/AttachmentList/AttachmentCenter/index.vue'
	)

// 404
const Error404 = () =>
	import(
		/* webpackChunkName: "error-404" */ '@/entry_desktop/components/ExceptionPage/404.vue'
	)

const routes: Array<RouteRecordRaw> = [
	{
		path: '/',
		name: 'Layout',
		component: BasicLayout,
		children: [
			{
				path: '/home',
				name: 'home',
				component: Home,
				meta: {
					title: $t('menu.home', '首页'),
				},
			},
			{
				path: '/process_center',
				name: 'process_center',
				component: ProcessCenter,
				meta: {
					title: $t('menu.processCenter', '流程中心'),
				},
			},
			{
				path: '/delegation',
				name: 'delegation',
				component: delegation,
				// meta: {
				// 	title: $t('menu.navTitle.delegation', '委托授权'),
				// },
			},
			{
				path: '/add_delegation',
				name: 'add_delegation',
				component: AddDelegation,
				meta: {
					title: $t('menu.navTitle.delegation', '新增'),
				},
			},
			{
				path: '/history_dataset_associations',
				name: 'history_dataset_associations',
				component: HistoryDatasetAssociations,
				// meta: {
				// 	title: $t('menu.navTitle.delegation', '新增'),
				// },
			},
			{
				path: '/ego_app',
				name: 'https://test.yigowork.com/ego_app/apps-admin', // TODO 暂时写死
				component: Error404,
				meta: {
					title: $t('menu.egoApp', '应用管理'),
				},
			},
			//个人中心
			{
				path: '/PersonalCenter',
				name: 'PersonalCenter',
				component: PersonalCenter,
				// redirect: '/PersonalCenter/BasicInformation',
				// children: [
				// 	{
				// 		path: 'BasicInformation',
				// 		name: 'BasicInformation',
				// 		component: BasicInformation,
				// 	},
				// 	{
				// 		path: 'Password',
				// 		name: 'Password',
				// 		component: Password,
				// 	},
				// ],
			},
			//三级详情
			{
				path: '/AttachmentList/AttachmentDetail',
				name: 'AttachmentDetail',
				component: AttachmentDetail,
				meta: {},
			},
			//二级中心
			{
				path: '/AttachmentList/AttachmentCenter',
				name: 'AttachmentCenter',
				component: AttachmentCenter,
				meta: {},
			},

			{
				path: '/:pathMatch(.*)',
				component: Error404,
				meta: {
					title: $t('menu.error', '错误页'),
					hidden: true,
				},
			},
		],
	},
]

export default routes
